brushless5 2.2.0
brushless5


Brushless 5 Click

Brushless 5 Click demo application is developed using the NECTO Studio, ensuring compatibility with mikroSDK's open-source libraries and tools. Designed for plug-and-play implementation and testing, the demo is fully compatible with all development, starter, and mikromedia boards featuring a mikroBUS™ socket.


Click Library

  • Author : Nikola Peric
  • Date : Feb 2022.
  • Type : PWM type

Software Support

Example Description

This library contains an API for the Brushless5 Click driver. This example showcases how to initialize and use the Brushless 5 Click. The Click has a brushless 5 motor driver which controls the work of the motor through the BLDC terminal. In order for this example to work a motor and a power supply are needed.

Example Libraries

  • MikroSDK.Board
  • MikroSDK.Log
  • Click.Brushless5

Example Key Functions

Application Init

Initializes the GPIO driver and configures the PWM peripheral for controlling the speed of the motor.

void application_init ( void )
{
log_cfg_t log_cfg;
LOG_MAP_USB_UART( log_cfg );
log_init( &logger, &log_cfg );
log_info( &logger, "---- Application Init ----" );
Delay_ms ( 100 );
// Click initialization.
BRUSHLESS5_MAP_MIKROBUS( cfg, MIKROBUS_1 );
brushless5_init( &brushless5, &cfg );
Delay_ms ( 100 );
brushless5_set_duty_cycle ( &brushless5, 0.0 );
brushless5_pwm_start( &brushless5 );
log_info( &logger, "---- Application Task ----" );
Delay_ms ( 1000 );
}
#define BRUSHLESS5_MAP_MIKROBUS(cfg, mikrobus)
Definition brushless5.h:66
void application_init(void)
Definition main.c:40

Application Task

This is an example that demonstrates the use of a Brushless 5 Click board. Brushless 5 Click communicates with the register via the PWM interface.
Increases and decreasing the speed of the motor demonstrate speed control. Results are being sent to the Usart Terminal where you can track their changes.

void application_task ( void )
{
static int8_t duty_cnt = 1;
static int8_t duty_inc = 1;
float duty = duty_cnt / 10.0;
brushless5_set_duty_cycle ( &brushless5, duty );
log_printf( &logger, "Duty: %d%%\r\n", ( uint16_t )( duty_cnt * 10 ) );
Delay_ms ( 500 );
if ( 10 == duty_cnt )
{
duty_inc = -1;
log_printf( &logger, " Slowing down... \r\n" );
}
else if ( 0 == duty_cnt )
{
duty_inc = 1;
log_printf( &logger, " Increasing the motor speed... \r\n" );
}
duty_cnt += duty_inc;
Delay_ms ( 500 );
}
void application_task(void)
Definition main.c:72

Application Output

This Click board can be interfaced and monitored in two ways:

  • Application Output - Use the "Application Output" window in Debug mode for real-time data monitoring. Set it up properly by following this tutorial.
  • UART Terminal - Monitor data via the UART Terminal using a USB to UART converter. For detailed instructions, check out this tutorial.

Additional Notes and Information

The complete application code and a ready-to-use project are available through the NECTO Studio Package Manager for direct installation in the NECTO Studio. The application code can also be found on the MIKROE GitHub account.